home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / gamesrc / mancala / rnd.h < prev   
C/C++ Source or Header  |  1994-08-24  |  1KB  |  41 lines

  1. /*
  2.  * rnd.h
  3.  */
  4.  
  5. /*
  6.  * Exported features:
  7.  *   rnd_t
  8.  *     Data type.  No user accessible features.
  9.  *   uint rnd(void)
  10.  *     Returns a random bit pattern with the MSB cleared.
  11.  *   void rnd_init(rnd_t *state, int seed)
  12.  *     Initalizes state to be a random seed value.  It does NOT modify which
  13.  *     rnd_t rnd() will use.
  14.  *   void rnd_use(rnd_t *state)
  15.  *     Sets the rnd_t that rnd() will use.  State must have been set up by
  16.  *     rnd_init(state, seed).  Passing NULL to rnd_use() will disable the
  17.  *     random number generator, but "lock down" the state currently in use.
  18.  *     If you want to copy a state, you have to lock it down first to
  19.  *     guarantee you get all information necessary.
  20.  */
  21.  
  22.  
  23. #ifndef  _RND_H_
  24. #define  _RND_H_
  25.  
  26. typedef unsigned int  uint;
  27.  
  28. #define  RND_DATASIZE  31
  29. #define  RND_INDENT    3
  30. typedef struct  {
  31.     uint  indent;
  32.     uint  data[RND_DATASIZE];
  33. } rnd_t;
  34.  
  35.  
  36. extern uint  rnd(void);
  37. extern void  rnd_init(rnd_t *state, int seed);
  38. extern void  rnd_use(rnd_t *state);
  39.  
  40. #endif
  41.